package com.sshc625.utils
{
	public class ArrayUtil
	{
		/**
		 *       Determines whether the specified array contains the specified value.
		 *
		 *       @param arr The array that will be checked for the specified value.
		 *
		 *       @param value The object which will be searched for within the array
		 *
		 *       @return True if the array contains the value, False if it does not.
		 *
		 *       @langversion ActionScript 3.0
		 *       @playerversion Flash 9.0
		 *       @tiptext
		 */
		public static function arrayContainsValue(arr:Array, value:Object):Boolean
		{
			return (arr.indexOf(value) != -1);
		}
		
		/**
		 *       Remove all instances of the specified value from the array,
		 *
		 *       @param arr The array from which the value will be removed
		 *
		 *       @param value The object that will be removed from the array.
		 *
		 *       @langversion ActionScript 3.0
		 *       @playerversion Flash 9.0
		 *       @tiptext
		 */
		public static function removeValueFromArray(arr:Array, value:Object):void
		{
			var len:uint = arr.length;
			
			for(var i:Number = len; i > -1; i--)
			{
				if(arr[i] === value)
				{
					arr.splice(i, 1);
				}
			}
		}
	}
}